﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace StarLabel.label.item
{
    /// <summary>
    /// Copyright 2019  ZhengJi. All Rights Reserved.
    /// 条码标签定义
    /// </summary>
    public class BarItem:Item
    {
        public BarItem(XmlElement el) : base(el)
        {
        }

        public string BarHeight { get; set; }
       

        public string CodeType { get; set; }

        public string Readable { get; set; }

        public string Wide { get; set; }
        public string Narrow { get; set; }
        protected override void parseFromXml()
        {
            this.DataField = this.xmlEl.Attributes["DataField"] == null ? "":this.xmlEl.Attributes["DataField"].Value;

            this.BarHeight = this.xmlEl.Attributes["BarHeight"]==null?"90": this.xmlEl.Attributes["BarHeight"].Value;
            this.CodeType = this.xmlEl.Attributes["CodeType"]==null?"128": this.xmlEl.Attributes["CodeType"].Value;
             
            this.Readable = this.xmlEl.Attributes["Readable"]==null?"0": this.xmlEl.Attributes["Readable"].Value;

            this.Wide = this.xmlEl.Attributes["Wide"] == null ? "2" : this.xmlEl.Attributes["Wide"].Value;
            this.Narrow = this.xmlEl.Attributes["Narrow"] == null ? "2" : this.xmlEl.Attributes["Narrow"].Value;
            base.parseFromXml();
        }
        public override void DrawLabel(float x, float y,string labelText,string rotation)
        {
            // TSCPrint.barcode(x.ToString(), y.ToString(), this.CodeType, this.BarHeight, this.Readable, this.Rotation, this.Narrow, this.Wide, labelText);

            TSCPrint.barcode(x.ToString(), y.ToString(), this.CodeType, this.BarHeight, this.Readable, rotation, this.Narrow, this.Wide, labelText);
        }
    }
}
